//https://leetcode.cn/problems/shu-zhi-de-zheng-shu-ci-fang-lcof/

double myPow(double x, int n) {
    if (n == 0)
    {
        return 1;
    }
    if (n == 1)
    {
        return x;
    }
    if (n < 0)
    {
        return 1 / x * myPow(1 / x, -n - 1);
    }
    if (n % 2 != 0)
    {
        return x * myPow(x, n / 2) * myPow(x, n / 2);
    }
    else
        return myPow(x, n / 2) * myPow(x, n / 2);

}
